package com.yangle.frame.bizlogic.service;

import com.yangle.frame.bizlogic.entity.BlogBanner;
import com.yangle.frame.bizlogic.mapper.BlogBannerMapper;
import com.yangle.frame.common.service.BaseService;
import com.yangle.frame.common.utils.MapperUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.Arrays;
import java.util.List;

/**
* Created by yangle on 2018/5/27.
*/
@Service
public class BlogBannerService implements BaseService<BlogBanner> {
@Autowired
private BlogBannerMapper blogBannerMapper;

public List<BlogBanner> getAll(BlogBanner blogBanner) {
Example example = MapperUtils.getExampleByClass(BlogBanner.class, blogBanner);
return blogBannerMapper.selectByExample(example);
}

public void create(BlogBanner blogBanner) {
blogBannerMapper.insert(blogBanner);
}

public void update(BlogBanner blogBanner) {
blogBannerMapper.updateByPrimaryKey(blogBanner);
}

public BlogBanner select(String id) {
return blogBannerMapper.selectByPrimaryKey(id);
}

public void delete(String ids) {
blogBannerMapper.deletes(Arrays.asList(ids.split(",")));
}
}
